home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Apple WWDC 1996
/
WWDC96_1996 (CD).toast
/
Technology Materials
/
MacOS 8 Resources
/
Developer Tools
/
Mac OS 8 Interfaces & Libraries
/
Interfaces
/
AIncludes
/
AdminMessagePort.a
< prev
next >
Wrap
Text File
|
1996-05-01
|
3KB
|
122 lines
;
; File: AdminMessagePort.a
;
; Contains: xxx put contents here xxx
;
; Version: Technology: xxx put the technology version here xxx
; Release: Universal Interfaces 3.0d3 on Copland DR1
;
; Copyright: © 1984-1996 by Apple Computer, Inc. All rights reserved.
;
; Bugs?: If you find a problem with this file, send the file and version
; information (from above) and the problem description to:
;
; Internet: apple.bugs@applelink.apple.com
; AppleLink: APPLE.BUGS
;
;
IF &TYPE('__ADMINMESSAGEPORT__') = 'UNDEFINED' THEN
__ADMINMESSAGEPORT__ SET 1
IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
include 'Types.a'
ENDIF
IF FOR_SYSTEM8_PREEMPTIVE THEN
;
;//------------------------------------------------------------------------------------
;
; The I/O system reserves one bit of the Kernel message system's type mask to use
; for administration messages. Different services within the I/O system use this
; single message type. The routine and constants described in this file are used
; by clients of these administration services to distinguish between the different
; types.
;
; It is intended that clients of I/O administration services use a single Kernel
; message port (PortID) for all messages: administration and data. Clients can
; create multiple message objects (ObjectID) for the same port and pass a different
; object to each administration service and use another for data handling.
;
; The client should use separate tasks to receive administration messages and data
; messages. Use the message type parameter of ReceiveMessage as a bit-mask to specify
; the type of message to receive in each task. The code below shows an example of an
; administration task.
;
; AdministrationTask()
; {
; MessageControlBlock mcb;
; union {
; DevNMessage devn;
; PMMessage pm;
; Arbitration arb;
; } adminBuffer;
; UInt32 messageType;
;
; while (true)
; {
; ReceiveMessageSync(adminPort, kAMPMessageTypeMask, &mcb, &adminBuffer, ...)
; AMPGetMessageType(mcb->messageContents, &messageType);
;
; switch (messageType)
; {
; case kAMPDeviceNotificationMsg:
; {
; DevNMessage* devn = mcb.messageContents;
; switch (devn->subMessageType)
; {
; ...
; }
; }
; break;
; case kAMPPowerManagementMsg:
; {
; PMMessage* pm = mcb.messageContents;
; switch (pm->type)
; {
; ...
; }
; }
; break;
; case kAMPArbitrationServiceMsg:
; {
; Arbitration* arb = mcb.messageContents;
; switch (arb->type)
; {
; ...
; }
; }
; break;
; default:
; break;
; }
; }
; }
;
;//------------------------------------------------------------------------------------
;
; Constants for use in ReceiveMessage.
kAMPMessageTypeMask EQU $08000000 ; highest bit not reserved by the kernel
kNonKernelNonAMPMessageTypes EQU $07FFFFFF
; Constants returned by AMPGetMessageType
kAMPDeviceNotificationMsg EQU 1
kAMPPowerManagementMsg EQU 2
kAMPArbitrationServiceMsg EQU 3
;
; AMPGetMessageType:
;
; Given an I/O administration message this routine determines the type of
; message. If the type cannot be deteremined zero is returned and debugging
; builds throw an assertion.
;
;
; extern void AMPGetMessageType(void *messageContents, UInt32 *messageType)
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION AMPGetMessageType
ENDIF
ENDIF
ENDIF ; __ADMINMESSAGEPORT__